package com.jt.www.enums.issue;

import org.apache.commons.lang.StringUtils;

/*
 *  诚泰团体证件枚举映射
 * @Author xq.wu
 * @Date 16:56 2020/10/29
 * @Param
 * @return
 **/
public enum IdTypeEnum {

    //组织机构代码证
    Organization(10, "1"),
    //营业执照
    BusinessLicense(15, "3"),
    //统一社会信用代码
    SocialCreditCode(18, "4");

    private int length;
    private String type;

    IdTypeEnum(int length, String type) {
        this.length = length;
        this.type = type;
    }

    public static String getType(int length) {
        if (StringUtils.isBlank(String.valueOf(length))) {
            return "";
        }
        for (IdTypeEnum idTypeEnum : IdTypeEnum.values()) {
            if (idTypeEnum.length == length) {
                return idTypeEnum.type;
            }
        }
        return "";
    }

    public int getLength() {
        return length;
    }

    public String getType() {
        return type;
    }
}
